package com.sunriz.refreshhcdata.server.Impl;

import com.sunriz.refreshhcdata.POJO.InfoWriteDO;
import com.sunriz.refreshhcdata.POJO.InfoWriteDTO;
import com.sunriz.refreshhcdata.POJO.McHcRelationshipDO;
import com.sunriz.refreshhcdata.mapper.InfoWriteMapper;
import com.sunriz.refreshhcdata.mapper.McHcRelationshipMapper;
import com.sunriz.refreshhcdata.server.SendDataServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.*;
import java.util.function.Consumer;

/**
 * ClassName: SendDataServerImpl
 * Package: com.sunriz.refreshhcdata.server.Impl
 * Description:
 *
 * @Author BuTang
 * @Create 2024/10/15 15:55
 * @Version 1.0
 */
@Service
public class SendDataServerImpl implements SendDataServer {

    @Autowired
    InfoWriteMapper infoWriteMapper;



    @Override
    public List<InfoWriteDTO> getSendValue() {

        // 从数据库获取配置，创建返回集合
        List<InfoWriteDO> list = infoWriteMapper.getList();
        List<InfoWriteDTO> returnList = new ArrayList<>();
        for (int i = 0; i < list.size(); i++) {

            // 获取取值范围内的随机数
            InfoWriteDO infoWriteDO = list.get(i);
            String hcPropertyKey = infoWriteDO.getHcPropertyKey();
            InfoWriteDTO infoWriteDTO = new InfoWriteDTO(hcPropertyKey,infoWriteDO.getInfoName(),infoWriteDO.getValue());
            returnList.add(infoWriteDTO);

        }
        return returnList;
    }
}
